package nl.tudelft.jpacman.board;

import nl.tudelft.jpacman.sprite.Sprite;
import java.util.List;

public abstract class Unit {
    private Square square;

    public Square getSquare() {
        return square;
    }

    public void occupy(Square target) {
        if (target == null) {
            throw new NullPointerException("Target square must not be null.");
        }

        if (square != null) {
            square.removeOccupant(this);
        }

        target.putOccupant(this);
        square = target;
    }

    public boolean hasSquare() {
        return square != null;
    }

    public abstract List<Sprite> getSprites();

    public void setDirection(Direction direction) {
    }

    public Square squaresAheadOf(int squaresAhead) {
        return null;
    }

    public Sprite getSprite() {
        return null;
    }

    public class Player extends Unit {
        @Override
        public List<Sprite> getSprites() {
            return null;
        }

        @Override
        public Sprite getSprite() {
            // 返回实际的玩家精灵
            Sprite playerSprite = null;
            return null;
        }
    }

    // Ghost.java
    public class Ghost extends Unit {
        @Override
        public List<Sprite> getSprites() {
            return null;
        }

        @Override
        public Sprite getSprite() {
            // 返回实际的幽灵精灵
            Sprite ghostSprite = null;
            return null;
        }
        // ... 其他方法 ...
    }
}
